<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// 上传
Route::post('/upload/image', 'UploadController@upload')->name('upload');

Route::post('/user/login', 'LoginController@login')->name('login');

Route::post('/user/aliLogin', 'LoginController@aliLogin')->name('login');

Route::post('/user/register', 'LoginController@register')->name('register');
Route::post('/user/changePassword', 'LoginController@changePassword')->name('changePassword');
Route::post('/user/changeMobile', 'LoginController@changeMobile')->name('changeMobile');

Route::post('/user/mpLogin', 'LoginController@mpLogin')->name('mp_login');
Route::post('/user/mpGetPhone', 'LoginController@getPhone');
Route::post('/user/mpReg', 'LoginController@mpReg')->name('mp_reg');
Route::post('/user/update', 'LoginController@update');
Route::get('/user/info', 'LoginController@getUserInfo');
Route::get('/user/editName', 'LoginController@editName');
Route::get('/user/checkFast', 'LoginController@getFastContract');
Route::get('/user/bindDevice', 'LoginController@bindDevice');
Route::post('/user/updateOpenId', 'LoginController@updateOpenId')->name('update_openid');
Route::get('/user/updateSub', 'LoginController@updateSub')->name('update_sub');
Route::get('/user/subStatus', 'LoginController@subStatus')->name('sub_status');
Route::get('/user/subWarning', 'LoginController@subWarning')->name('sub_warning');
Route::post('/user/updateAlipayId', 'LoginController@updateAlipayId');

Route::get('/user/getBills', 'LoginController@getBills');
Route::get('/user/billsList', 'LoginController@billsList');
Route::get('/user/getPowers', 'LoginController@getPowers');
Route::get('/user/deviceCount', 'LoginController@deviceCount');

Route::get('/index/business', 'IndexController@business')->name('index_business');
Route::get('/index/tenant', 'IndexController@tenant')->name('index_tenant');

Route::get('/house', 'HouseController@index');
Route::get('/house/{id}', 'HouseController@detail');
Route::get('/house/tags', 'HouseController@getTags');
Route::post('/house/create', 'HouseController@create');
Route::post('/house/update/{id}', 'HouseController@update');
Route::delete('/house/{id}', 'HouseController@destroy');

Route::post('houseClass/create', 'HouseClassController@create');
Route::get('houseClass/delete', 'HouseClassController@delete');
Route::get('houseClass/list','HouseClassController@getList');
Route::post('houseClass/batch','HouseClassController@batch');
Route::get('houseClass/getOne', 'HouseClassController@getOne');
Route::get('houseClass/clearClass', 'HouseClassController@clearClass');
Route::get('houseClass/getSelfHouses', 'HouseClassController@getSelfHouses');

Route::post('/ttlock/saveUser', 'TtlockController@saveUser');
Route::post('/ttlock/changePassword', 'TtlockController@changePassword');
Route::post('/ttlock/deleteUser', 'TtlockController@deleteUser');
Route::get('/ttlock/userDetail', 'TtlockController@userDetail');
Route::post('/ttlock/bind', 'TtlockController@bind');
Route::post('/ttlock/unbind', 'TtlockController@unbind');
Route::post('/ttlock/updatePassword', 'TtlockController@updatePassword');
Route::get('/ttlock/freeze','TtlockController@freeze');
Route::get('/ttlock/keyList','TtlockController@keyList');
Route::get('/ttlock/lockList','TtlockController@lockList');

Route::get('/house/getTenant', 'HouseController@getTenant');
Route::get('/house/filter/config', 'HouseController@getFilterConfig');

Route::get('/contract', 'ContractController@index');
Route::get('/contract/checkTenant', 'ContractController@checkTenant');
Route::get('/contract/checkRecharge', 'ContractController@checkRecharge');
Route::get('/ocr_card', 'ContractController@ocrCard');
Route::get('/contract/{id}', 'ContractController@detail');
Route::post('/contract/{id}/update', 'ContractController@update');
Route::post('/contract/{id}/changeExpireDate', 'ContractController@changeExpireDate');
Route::post('/contract/{id}/break', 'ContractController@break');
Route::post('/contract/{id}/breakFast', 'ContractController@breakFast');
Route::post('/contract/create', 'ContractController@create');
Route::post('/contract/createFast', 'ContractController@createFast');
Route::post('/contract/fastLease', 'ContractController@fastLease');
Route::get('/contract/fastDetail', 'ContractController@fastDetail');
Route::get('/contract/removeTenant', 'ContractController@removeTenant');
Route::post('/contract/{id}/submit', 'ContractController@submit');
Route::post('/contract/updateRent', 'ContractController@updateRent');
Route::post('/contract/updateTenant', 'ContractController@updatetenant');
Route::post('/contract/batchTenant', 'ContractController@batchTenant');
Route::delete('/contract/{id}/destroy', 'ContractController@destroy');
Route::post('/contract/bill/{id}/paid', 'BillController@billPay');
Route::get('/contract/bill/{id}', 'BillController@billDetail');
Route::delete('/contract/bill/{id}/destroy', 'BillController@billDestroy');
Route::post('/contract/bill/{id}/changePayDate', 'BillController@changePayDate');
Route::get('/contract/bill/preview', 'ContractController@previewBill');
Route::get('/contract/{id}/changeExpirePreviewBill', 'ContractController@changeExpiredPreviewBill');

Route::post('/sendSmsCode', 'ContractController@sendSmsCode')->name('send_sms_code');

Route::get('/repair', 'RepairController@index');
Route::get('/repair/{id}', 'RepairController@detail');
Route::post('/repair/{id}/confirm', 'RepairController@confirm');

Route::get('/device', 'DeviceController@index');
Route::get('/device/test', 'DeviceController@testIndex');
Route::get('/device/getAdmin', 'DeviceController@getAdmin');
Route::post('/device/shareMobile', 'DeviceController@shareMobile');
Route::get('/device/{id}', 'DeviceController@detail')->name('device_detail');
Route::get('/device/search', 'DeviceController@search')->name('device_search');
Route::post('/device/create', 'DeviceController@create');
Route::post('/device/{id}/update', 'DeviceController@update');
Route::post('/device/{id}/read', 'DeviceController@read');
Route::delete('/device/{id}', 'DeviceController@destroy');
Route::post('/device/{id}/unbind', 'DeviceController@unbind');
Route::post('/device/editSpeed','DeviceController@speedLog');//修改公摊
Route::get('/device/restart', 'DeviceController@restart');
Route::get('/device/setMode', 'DeviceController@setMode');
Route::get('/device/editDu', 'DeviceController@editDu');
Route::get('/device/setBus', 'DeviceController@setBus');
Route::get('/device/removeBus', 'DeviceController@removeBus');
Route::get('/device/editBus', 'DeviceController@editBus');
Route::post('/device/joinBus', 'DeviceController@joinBus');
Route::get('/device/busDetail', 'DeviceController@busDetail');
Route::get('/device/busLog', 'DeviceController@busLog');
Route::get('/device/editBusAuto', 'DeviceController@editBusAuto');
Route::get('/device/normalRate', 'DeviceController@normalRate');
Route::get('/device/getBusinessAmount', 'DeviceController@getBusinessAmount');
Route::get('/device/incrBusinessAmount', 'DeviceController@incrBusinessAmount');

Route::get('/deposit', 'DepositController@index');
Route::get('/deposit/{id}', 'DepositController@detail');
Route::post('/deposit/create', 'DepositController@create');
Route::post('/deposit/{id}/update', 'DepositController@update');

Route::get('/message', 'MessageController@index');
Route::post('/message/read', 'MessageController@read');
Route::post('/message/flush', 'MessageController@flush');


Route::get('/tenant/contract', 'TenantController@contract');
Route::get('/tenant/bills', 'TenantController@bills');

Route::get('/tenant/orders', 'TenantController@orders');

Route::get('/tenant/repair', 'TenantController@repairList');
Route::post('/tenant/repair/create', 'TenantController@repairCreate');
Route::post('/tenant/repair/{id}/confirm', 'TenantController@repairConfirm');

Route::get('/tenant/device', 'TenantController@deviceList');

// QA
Route::get('/qa', 'QAController@index')->name('qa');
Route::get('/qa/{id}', 'QAController@detail')->name('qa_detail');

// Feedback
Route::post('/feedback', 'FeedbackController@feedback');

// business config
Route::get('/business/conf', 'BusinessConfController@index')->name('business_conf');
Route::post('/business/conf', 'BusinessConfController@update');



Route::post('/business/updateCoef', 'BusinessConfController@updateCoef');
Route::get('/business/getLvPrice', 'BusinessConfController@getLvPrice');
Route::post('/business/createLvPrice', 'BusinessConfController@createLvPrice');
Route::get('/business/makeFg', 'BusinessConfController@makeFg');
// stat
Route::get('/business/stat', 'StatController@index');

Route::post('/ocr', 'OCRController@getOCRInfo');

Route::get('/article/detail', 'ArticleController@detail')->name('article');

Route::get('/getAddress', 'IndexController@getAddress');

// 电子签
Route::get('/fdd/info', 'FddController@getInfo');
Route::post('/fdd/updateInfo', 'FddController@updateInfo');
Route::get('/fdd/authUrl', 'FddController@getAuthUrl');
Route::get('/fdd/signTemplateList', 'FddController@getSignTemplateList');
Route::get('/fdd/signTemplateDetail', 'FddController@getSignTemplateDetail');
Route::post('/fdd/createSignTask', 'FddController@createSignTask');
Route::get('/fdd/getSignTaskUrl/{id}', 'FddController@getSignTaskUrl');
Route::get('/fdd/getSignTaskPreviewUrl/{id}', 'FddController@getSignTaskPreviewUrl');
Route::get('/fdd/getFreeSignUrl', 'FddController@getFreeSignUrl');
Route::get('/fdd/userUnbind', 'FddController@userUnbind');
Route::get('/fdd/getSignTaskDownloadUrl/{id}', 'FddController@getSignTaskDownloadUrl');

// ada pay
// 电费充值
Route::post('/payment/recharge','PaymentController@recharge');
Route::post('/payment/rechargeTemp','PaymentController@rechargeTemp');

// 账单支付
Route::post('/payment/billPay','PaymentController@billPay');

// 支付状态查询
Route::get('/payment/orderStatus','OrderController@orderStatus');
// 查询充值失败的订单
Route::get('/order/fail', 'OrderController@orderFailList');

Route::get('/order/today_count','OrderController@getTodayCount');

// 充值失败
Route::post('/order/fail', 'OrderController@rechargeFail');
// 充值成功
Route::post('/order/success', 'OrderController@rechargeSuccess');

//临时用电订单列表
Route::get('/order/tempList', 'OrderController@tempList');
Route::get('/order/businessTempList', 'OrderController@businessTempList');
Route::get('/order/getOrderDetail', 'OrderController@getOrderDetail');
//结束临时用电
Route::get('/order/tempEnd', 'OrderController@tempEnd');
// 4G充值
Route::post('/order/recharge', 'OrderController@recharge');
// 蓝牙充值
Route::post('/order/bleRecharge', 'OrderController@bleRecharge');
// 失败订单重新充值
Route::post('/order/tryRecharge', 'OrderController@tryRecharge');

// 支付账户
Route::get('/account', 'AccountController@index');
Route::get('/account/bankCode', 'AccountController@getBankCode');
Route::post('/account/bindBank', 'AccountController@bindBank');
Route::post('/account/unbindBank', 'AccountController@unbindBank');
Route::post('/account/drawCash', 'AccountController@drawCash');
Route::post('/account/sendSmsCode', 'AccountController@sendSmsCode');
Route::post('/account/checkSmsCode', 'AccountController@checkSmsCode');
Route::get('/account/cashLog', 'AccountController@cashLog');

Route::post('/account/business', 'AccountController@businessBank');
Route::post('/account/identifyImg', 'AccountController@identifyImg');
Route::get('/account/submit', 'AccountController@submitBusiness');
Route::get('/account/bankDetail', 'AccountController@bankDetail');
Route::get('/account/test11', 'AccountController@test11');
// 设备操作
// 拉闸
Route::post('/device/stop', 'DeviceController@stop');
// 合闸
Route::post('/device/start', 'DeviceController@start');
Route::post('/device/restart', 'DeviceController@restart');
// 清零
Route::post('/device/clear', 'DeviceController@clear');
Route::post('/device/clear_success', 'DeviceController@clearSuccess');
// 手动充值
Route::post('/device/recharge', 'DeviceController@recharge');
// 操作日志
Route::get('/device/{id}/log', 'DeviceController@log');

Route::get('/device/new_business_conf', 'DeviceController@getBusinessConf');
// 调表
Route::post('/device/speed', 'DeviceController@speed');
Route::post('/device/querySpeed', 'DeviceController@querySpeed');
// 查表
Route::post('/device/statusQuery', 'DeviceController@statusQuery');

#设备二维码
Route::post('/device/{id}/qrcode', 'QrCodeController@deviceQrCode');

Route::get('/business/bill', 'BillController@myBills');
Route::get('/business/bill1', 'BillController@myBills1');
Route::get('/business/bill_export', 'BillController@myBillsExport');

# 临时设备
Route::get('/tempDevice', 'DeviceController@tempDeviceList');
Route::post('/tempDevice', 'DeviceController@tempDeviceAdd');
Route::post('/getDeviceListByIds', 'DeviceController@getDeviceListByIds')->name('device_list');


Route::post('/admin/create', 'AdminController@create');
Route::post('/admin/edit', 'AdminController@edit');
Route::get('/admin/list', 'AdminController@list');
Route::post('/admin/delete', 'AdminController@del');

Route::get('/device/restart_master', 'DeviceController@restartMaster');
